﻿using System;
using System.Text;
using System.Threading;
using Mono.Collections.Generic;

namespace Mono.Cecil
{
	// Token: 0x0200006D RID: 109
	public sealed class GenericInstanceMethod : MethodSpecification, IGenericInstance, IMetadataTokenProvider, IGenericContext
	{
		// Token: 0x170000C3 RID: 195
		// (get) Token: 0x0600046B RID: 1131 RVA: 0x0001C218 File Offset: 0x0001A418
		public bool HasGenericArguments
		{
			get
			{
				return !this.arguments.IsNullOrEmpty<TypeReference>();
			}
		}

		// Token: 0x170000C4 RID: 196
		// (get) Token: 0x0600046C RID: 1132 RVA: 0x0001C238 File Offset: 0x0001A438
		public Collection<TypeReference> GenericArguments
		{
			get
			{
				bool flag = this.arguments == null;
				if (flag)
				{
					Interlocked.CompareExchange<Collection<TypeReference>>(ref this.arguments, new Collection<TypeReference>(), null);
				}
				return this.arguments;
			}
		}

		// Token: 0x170000C5 RID: 197
		// (get) Token: 0x0600046D RID: 1133 RVA: 0x0000A3A0 File Offset: 0x000085A0
		public override bool IsGenericInstance
		{
			get
			{
				return true;
			}
		}

		// Token: 0x170000C6 RID: 198
		// (get) Token: 0x0600046E RID: 1134 RVA: 0x0001C270 File Offset: 0x0001A470
		IGenericParameterProvider IGenericContext.Method
		{
			get
			{
				return base.ElementMethod;
			}
		}

		// Token: 0x170000C7 RID: 199
		// (get) Token: 0x0600046F RID: 1135 RVA: 0x0001C288 File Offset: 0x0001A488
		IGenericParameterProvider IGenericContext.Type
		{
			get
			{
				return base.ElementMethod.DeclaringType;
			}
		}

		// Token: 0x170000C8 RID: 200
		// (get) Token: 0x06000470 RID: 1136 RVA: 0x0001C2A8 File Offset: 0x0001A4A8
		public override bool ContainsGenericParameter
		{
			get
			{
				return this.ContainsGenericParameter() || base.ContainsGenericParameter;
			}
		}

		// Token: 0x170000C9 RID: 201
		// (get) Token: 0x06000471 RID: 1137 RVA: 0x0001C2CC File Offset: 0x0001A4CC
		public override string FullName
		{
			get
			{
				StringBuilder stringBuilder = new StringBuilder();
				MethodReference elementMethod = base.ElementMethod;
				stringBuilder.Append(elementMethod.ReturnType.FullName).Append(" ").Append(elementMethod.DeclaringType.FullName).Append("::").Append(elementMethod.Name);
				this.GenericInstanceFullName(stringBuilder);
				this.MethodSignatureFullName(stringBuilder);
				return stringBuilder.ToString();
			}
		}

		// Token: 0x06000472 RID: 1138 RVA: 0x00003BAE File Offset: 0x00001DAE
		public GenericInstanceMethod(MethodReference method) : base(method)
		{
		}

		// Token: 0x06000473 RID: 1139 RVA: 0x00003BB9 File Offset: 0x00001DB9
		internal GenericInstanceMethod(MethodReference method, int arity) : this(method)
		{
			this.arguments = new Collection<TypeReference>(arity);
		}

		// Token: 0x04000121 RID: 289
		private Collection<TypeReference> arguments;
	}
}
